package com.loyal.loyalerp.basedata.action.mapper.provider;

public class GyActionProvider {
	
	//根据actioncode查actionname
	public String selectActionNameByActionCode(String actioncode) {
		return "select * from gy_action where actioncode='"+actioncode+"'";
	}
	
	//根据actionname查actioncode
	public String selectActionCodeByActionName(String actionname) {
		return "select * from gy_action where actionname='"+actionname+"'";
	}
	
	public String listById(Integer id) {
		return "select actioncode from gy_action where id = "+id;
	}
	
	public String listGyaAtion(String sidx,String sord) {
		return "select * from gy_action order by "+sidx+" "+sord;
	}
	
	public String findGyAction(String searchField,String searchString,String searchOper) {
		String search = null;
		if(searchOper.equals("eq")) {
			search="select * from gy_action where "+searchField+" like CONCAT(CONCAT(\'%\',\'"+searchString+"\',\'%\'))";
		}else if(searchOper.equals("ne")){
			search="select * from gy_action where "+searchField+" not like CONCAT(CONCAT(\'%\',\'"+searchString+"\',\'%\'))";
		}
		return search;
		
	}
}
